package njupt.proxy;

import java.util.List;

import njupt.dao.PingJiaDAO;
import njupt.daoimp.GoodsDAOimp;
import njupt.daoimp.PingJiaDAOimp;
import njupt.dbc.DatabaseConnnection;

/**
 * @author leon(liangzou0318@gmail.com)
 * @date 2012-4-22
 * @filaname PingJiaDAOProxy.java
 */
public class PingJiaDAOProxy implements PingJiaDAO{
	DatabaseConnnection dbc =null;
	private PingJiaDAO dao;
	public PingJiaDAOProxy(){
	   try{	
			this.dbc=new DatabaseConnnection();
			}catch(Exception e){
				e.printStackTrace();
			}
			
			if(this.dbc.getConnection()==null){
				System.out.println("error collection!!");
			}
			this.dao=new PingJiaDAOimp(this.dbc.getConnection());
		}
	public int insertinfo(String pingjiainfo,String levelinfo,int userid,int goodsid) throws Exception{
		
		try{
			 return this.dao.insertinfo(pingjiainfo,levelinfo,userid, goodsid);//注意这个dao一定要写，不能会抛堆溢出
		  }catch(Exception e){
			  throw e;
		  }
		  
	}
	/* (non-Javadoc)
	 * @see njupt.dao.PingJiaDAO#disply_pingjia(int)
	 */
	public List<String[]> disply_pingjia(int goodsid) throws Exception {
		try{
			 return this.dao.disply_pingjia(goodsid);//注意这个dao一定要写，不能会抛堆溢出
		  }catch(Exception e){
			  throw e;
		  }finally{
			this.dbc.close();  
		  }
		  }
	/* (non-Javadoc)
	 * @see njupt.dao.PingJiaDAO#createTousu(java.lang.String, int, int, java.lang.String)
	 */
	public int createTousu(String tousuinfo, int userid, int orderid,
			int tousuStyle) throws Exception {
		try{
			 return this.dao.createTousu(tousuinfo, userid, orderid, tousuStyle);//注意这个dao一定要写，不能会抛堆溢出
		  }catch(Exception e){
			  throw e;
		  }finally{
			this.dbc.close();  
		  }
	}
	/* Overriding methods
	 */
	public List<String[]> select(int type) throws Exception {
		try{
			 return this.dao.select(type);//注意这个dao一定要写，不能会抛堆溢出
		  }catch(Exception e){
			  throw e;
		  }finally{
			this.dbc.close();  
		  }
		  }
	/* Overriding methods
	 */
	public int updateTousuStatus(int orderid, int status) throws Exception {
		try{
			 return this.dao.updateTousuStatus(orderid, status);//注意这个dao一定要写，不能会抛堆溢出
		  }catch(Exception e){
			  throw e;
		  }finally{
			this.dbc.close();  
		  }
	}
	/* Overriding methods
	 */
	public List<String> selectTousuinfoToHander(int orderid) throws Exception {
		try{
			 return this.dao.selectTousuinfoToHander(orderid);//注意这个dao一定要写，不能会抛堆溢出
		  }catch(Exception e){
			  throw e;
		  }finally{
			this.dbc.close();  
		  }
	}
	/* Overriding methods
	 */
	public int insertTousuChuli(int orderid, String chuliinfo) throws Exception {
		try{
			 return this.dao.insertTousuChuli(orderid, chuliinfo);//注意这个dao一定要写，不能会抛堆溢出
		  }catch(Exception e){
			  throw e;
		  }finally{
			this.dbc.close();  
		  }
	}
	/* Overriding methods
	 */
	public List<String> selectTousuByCustmer(int orderid) throws Exception {
		try{
			 return this.dao.selectTousuByCustmer(orderid);//注意这个dao一定要写，不能会抛堆溢出
		  }catch(Exception e){
			  throw e;
		  }finally{
			this.dbc.close();  
		  }
	}
	/* Overriding methods
	 */
	public List<Integer> selectOrderidForCustmerShowTousu(int userid)
			throws Exception {
		try{
			 return this.dao.selectOrderidForCustmerShowTousu(userid);//注意这个dao一定要写，不能会抛堆溢出
		  }catch(Exception e){
			  throw e;
		  }finally{
			this.dbc.close();  
		  }
	}
	}
